/**
 * problem_039.cpp
 * Copyright (C) 2011 - xrose
 */

#include <iostream>
#define sqr(x) (x)*(x)
using namespace std;

int isRightTriangle(int a, int b, int c)
{
	if(sqr(a)+sqr(b) == sqr(c))
	{
		return 1;
	}else
	{
		return 0;
	}
}

int cntSolution(int p)
{
	int cnt = 0;
	for(int a = 1; a<=(p/3); a++)
	{
		for(int b = a; b<=(2*p/3); b++)
		{
			if(isRightTriangle(a, b, p-a-b))
			{
				cnt++;
			}
		}
	}
	return cnt;
}
int main (int argc, char const* argv[])
{
    int mSol = 0;
	for(int i = 2; i<=1000; i++)
	{
        if(cntSolution(i)>mSol)
        {
            mSol = cntSolution(i);
            cout<<"max solution is: "<<mSol<<endl;
            cout<<"max p is: "<<i<<endl;
        }
	}
	cout<<"max solution is: "<<mSol<<endl;
	return 0;
}
